<?php

class LogoutController extends Controller
{
    public $layout = 'main';
	public $defaultAction = 'logout';
	
	/**
	 * Logout the current user and redirect to returnLogoutUrl.
	 */
	public function actionLogout()
	{
        $back=Yii::app()->request->getParam('back', 0);

        Yii::app()->user->logout();
        if($back){
            $this->redirect($this->createUrl('/user/login',array('back'=>1)));
        }   else{
            $this->redirect(Yii::app()->controller->module->returnLogoutUrl);
        }

	}

}